<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	UserBean user = (UserBean)request.getSession().getAttribute("userBean");
	String _db = user.getDbType();
	String userName = user.getUserrelName(); 
	String orgName = user.getCurOrgName();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="pragma" content="no-cache"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>药具入库管理</title>

		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />

		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/validata.js"></script>

		<script type="text/javascript" src="ligerUI/js/plugins/ligerGrid.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerForm.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerComboBox.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerDateEditor.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerResizable.js"></script>
		
<script type="text/javascript">
var _db = '<%=_db%>';
var userName = '<%=userName%>';
var orgName = '<%=orgName%>';

_jsonObj.classname = "com.wxtf.platform.main.contraceptives.TmaIncomeAction";
_jsonObj.methodname = "queryPage";

var manager;//入库表格
var detail;//明细
var chakan;
var mingxi = [];
var tmaid = 0;
var rukubianhao = "00000";
$(function(){
	manager = $("#manager").ligerGrid({
		url: _url, parms: _jsonObj, width: '100%', height: '100%',enabledSort:false,pageSize:100,
		usePager: true, rownumbers: true, checkbox: true, alternatingRow: true,async:false,
		columns: [
			{ display: 'tmaim_id', name: 'tmaim_ids', hide: true,width:1 },
			{ display: 'org_id', name: 'org_id', hide: true,width:1 },
			{ display: '入库编号', name: 'tmaim_code', width: 200, align: 'left', render: function(record, index, value, oth){
					return "<a href='javascript:Detail(" + JSON.stringify(record) + ")'>"+value+"</a>";
				}
			},
			{ display: '入库日期', name: 'tmaim_time', width: 150, align: 'left' },
			{ display: '类型', name: 'tmaim_type', width:  100, align: 'left',render: function(record, index, value, oth){
					if(value=="1"){
						return "手动录入";
					}else if(value=="0"){
						return "自动生成";
					}
				}},
			{ display: '录入人', name: 'create_by', width:  100, align: 'left' },
			{ display: '状态', name:'tmaim_is_valid',width:100, align: 'left' ,render: function(record, index, value, oth){
					if(value=="1"){
						return "有效";
					}else if(value=="0"){
						return "无效";
					}
				}
			},
			{ display: '查看', name:'edit',width:50,render: function(record, index, value, oth){
					return "<img src='ligerUI/skins/icons/search.gif' onclick='Detail(" + JSON.stringify(record) + ")'></img>";
				}
			}
		],
		toolbar: {
			items: [
				{ text: '新建', click: addData, icon: 'add' },
				{ line: true },
				{ text: '删除', click: delData, icon: 'delete'}
			]
		}	
	});
	
	//明细
	detail = $("#detail").ligerGrid({
		width: '660', height:'325',enabledSort:false,delayLoad:true,
		usePager: false, rownumbers: true, checkbox: true, alternatingRow: true,async:false,
		columns: [
			{ display: 'tmaid_id', name: 'tmaid_id', hide: true,width:1 },
			{ display: 't_tmgd_name', name: 't_tmgd_name', hide: true,width:1 },
			{ display: 't_tmad_name', name: 't_tmad_name', hide: true,width:1 },
			{ display: '药具种类', name: 'tmgd_name', width: 100, align: 'left' },
			{ display: '药品名称', name: 'tmad_name', width: 100, align: 'left' },			
			{ display: '生产厂家', name: 'tmad_company_name', width: 100, align: 'left' },
			{ display: '价格', name: 'tmad_price', width: 80, align: 'left' },
			{ display: '数量', name: 'tmaid_num', width: 80, align: 'left' },
			{ display: '金额', name: 'money', width: 80, align: 'left',render: function(record, index, value, oth){
					return formatCurrency(record.tmad_price * record.tmaid_num);
				} 
			},
			{ display: '修改', name:'edit',width:50,render: function(record, index, value, oth){
					return "<img src='ligerUI/skins/icons/edit.gif' onclick='edit(" + JSON.stringify(record) + ")'></img>";
				}
			}
		],
		toolbar: {
			items: [
				{ text: '新建', click: add, icon: 'add' },
				{ line: true },
				{ text: '删除', click: del,icon: 'delete'}
			]
		}
	});
	
	//查看
	chakan = $("#chakan").ligerGrid({
		url: _url, width: '690', height:'325',enabledSort:false,
		usePager: false, rownumbers: true, alternatingRow: true,async:false,delayLoad:true,
		columns: [
			{ display: '药具种类', name: 'tmgd_name', width: 100, align: 'left' },
			{ display: '药品名称', name: 'tmad_name', width: 150, align: 'left' },			
			{ display: '生产厂家', name: 'tmad_company_name', width: 100, align: 'left' },
			{ display: '价格', name: 'tmad_price', width: 100, align: 'left' },
			{ display: '数量', name: 'tmaid_num', width: 100, align: 'left' },
			{ display: '金额', name: 'money', width: 100, align: 'left' ,render: function(record, index, value, oth){
					return formatCurrency(record.tmad_price * record.tmaid_num);
				}
			}
		]
	});
});
/*
*药品名称
*/
function tmad_name_change(value){
	var paramId = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaIncomeAction",
		"methodname": "selectTmaDictionaryById",
		"logicdata": [],
		"extenddata": []
	};
	paramId.logicdata = '[{"tmad_id":"'+value+'"}]';
	callserver(paramId, function(data, satus){
		$("#tmad_price").val(data.tmad_price);
		$("#tmad_batch_code").val(data.tmad_batch_code);
		$("#tmad_qgp").val(data.tmad_qgp);
		$("#tmad_company_name").val(data.tmad_company_name);
		$("#tmad_unit").val(data.tmad_unit);
		$("#tmad_spec").val(data.tmad_spec);
		$("#tmad_description").val(data.tmad_description);
	},function(data, satus){
		warningTip(data.resultrecord);
	});
}
/*
*药具种类
*/
function tmgd_name_change(value){
	$("#tmad_name").find("option").remove();
	var paramName = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaIncomeAction",
		"methodname": "selectTmaDictionary",
		"logicdata": [],
		"extenddata": []
	};
	paramName.logicdata = '[{"tmgd_id":"'+value+'"}]';
	callserver(paramName, function(data, satus){
		$("#tmad_price").val("");
		$("#tmad_batch_code").val("");
		$("#tmad_qgp").val("");
		$("#tmad_company_name").val("");
		$("#tmad_unit").val("");
		$("#tmad_spec").val("");
		$("#tmad_description").val("");
		$("#tmad_name").append('<option value="">--请选择--</option>');
		$.each(data, function (i, item) {
        	 $("#tmad_name").append('<option value="'+item.tmad_id+'">'+item.tmad_name+'</option>');
        }); 
	},function(data, satus){
		warningTip(data.resultrecord);
	});
}
/*
 * 药品增加
 */
var add_dialog;
function add(){
	add_dialog==null?"":add_dialog.hide();
	document.getElementById('yaoju').reset();
	$("#tmgd_name").find("option").remove();
	$("#tmad_name").find("option").remove();
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaIncomeAction",
		"methodname": "selectTmGeneralDictionary",
		"logicdata": [],
		"extenddata": []
	};
	callserver(param, function(data, satus){
		$("#tmgd_name").append('<option value="">--请选择--</option>');
		$("#tmad_name").append('<option value="">--请选择--</option>');
		$.each(data, function (i, item) {
        	 $("#tmgd_name").append('<option value="'+item.tmgd_id+'">'+item.tmgd_name+'</option>');
        });
	},function(data, satus){
		warningTip(data.resultrecord);
	});
	add_dialog = initWindowByDiv('yaoju-div', '明细增加', 600, 210, save, closeWin);
}
/*
*药品删除
*/
function del(){
	var str = "";
    var rows = detail.getCheckedRows();
    $(rows).each(function (){
    	str += this.tmaid_id + ",";
    });
    str=str.substring(0,str.length-1);
	if(str == ""){
		warningTip('请至少选则一个药品进行操作');
		return;
	}
	$.ligerDialog.confirm('确定要删除选中的数据吗？', function (opt) { 			
		if(opt){
			var temp = mingxi;
			mingxi = [];
			$.each(temp, function (i, item) {
    			if(str.indexOf(item.tmaid_id)>=0){
					
				}else{
					mingxi.push({
    					tmaid_id:item.tmaid_id,
    					tmad_id:item.tmad_id,
    					tmaid_num:item.tmaid_num
    				});
				}
    		});
    		detail.deleteSelectedRow(); 
		}
	});
}
/*
 * 修改药品
 */
var edit_dialog;
function edit(r){
	document.getElementById('yaoju').reset();
	tmgd_name_change(r.t_tmgd_name);
	row	= {
		tmaid_id:r.tmaid_id,
		tmgd_name:r.t_tmgd_name,
		tmad_name:r.t_tmad_name,				
		tmaid_num:r.tmaid_num,
		tmad_company_name:r.tmad_company_name,
		tmad_price:r.tmad_price,
		tmad_batch_code:r.tmad_batch_code,
		tmad_unit:r.tmad_unit,
		tmad_spec:r.tmad_spec,
		tmad_description:r.tmad_description,
		tmad_qgp:r.tmad_qgp,
		money:parseInt(r.tmaid_num) * parseFloat(r.tmad_price)
	};
	loadForm("yaoju", row);
	edit_dialog = initWindowByDiv('yaoju-div', '明细修改', 600, 210, bianji, closeWin);	
}
/*
*药具编辑
*/
function bianji(){
	var tmgd_name = $("#tmgd_name").val().trim();
	var tmad_name = $("#tmad_name").val().trim();
	var tmaid_num = $("#tmaid_num").val().trim();
	if('' == tmgd_name){warningTip("药具类型：不能为空"); return;}
	if('' == tmad_name){warningTip("药品名称：不能为空"); return;}
	if('' == tmaid_num){warningTip("数量：不能为空"); return;}
	if(!checkIsNum(tmaid_num)){warningTip("数量：只能是整数"); return;}
	if(fucCheckLength(tmaid_num)>5){warningTip("数量：不能大于5位"); return;}
	var d = getForm("yaoju");
	//得到的JSON			
	var strJSON = d.substring(1,d.length-1);
	//转换后的JSON对象
	var obj = eval( "(" + strJSON + ")" );        
    var jsonObj = {};
    jsonObj.Rows = [];
	$.each(detail.getData(), function (i, item) {
		if(item.tmaid_id==obj.tmaid_id){
			jsonObj.Rows.push({
       			tmaid_id:obj.tmaid_id,
				tmgd_name:$("#tmgd_name").find("option:selected").text(),
				tmad_name:$("#tmad_name").find("option:selected").text(),
				t_tmgd_name:obj.tmgd_name,
				t_tmad_name:obj.tmad_name,				
				tmaid_num:obj.tmaid_num,
				tmad_company_name:obj.tmad_company_name,
				tmad_price:obj.tmad_price,
				tmad_batch_code:obj.tmad_batch_code,
				tmad_unit:obj.tmad_unit,
				tmad_spec:obj.tmad_spec,
				tmad_description:obj.tmad_description,
				tmad_qgp:item.tmad_qgp,
				money:parseInt(obj.tmaid_num) * parseFloat(obj.tmad_price)
       		});
		}else{
			jsonObj.Rows.push({
       			tmaid_id:item.tmaid_id,
				tmgd_name:item.tmgd_name,
				tmad_name:item.tmad_name,
				t_tmgd_name:item.t_tmgd_name,
				t_tmad_name:item.t_tmad_name,				
				tmaid_num:item.tmaid_num,
				tmad_company_name:item.tmad_company_name,
				tmad_price:item.tmad_price,
				tmad_batch_code:item.tmad_batch_code,
				tmad_unit:item.tmad_unit,
				tmad_spec:item.tmad_spec,
				tmad_description:item.tmad_description,
				tmad_qgp:item.tmad_qgp,
				money:parseInt(item.tmaid_num) * parseFloat(item.tmad_price)
       		});
		}			
    });
    detail.set({ data: jsonObj });
    var temp = mingxi;
    mingxi = [];
       $.each(temp, function (i, item) {
		if(item.tmaid_id==obj.tmaid_id){
			mingxi.push({
    			tmaid_id:obj.tmaid_id,
    			tmad_id:obj.tmad_name,
    			tmaid_num:obj.tmaid_num
    		});
		}else{
			mingxi.push({
    			tmaid_id:item.tmaid_id,
    			tmad_id:item.tmad_id,
    			tmaid_num:item.tmaid_num
    		});
		}			
    });
	edit_dialog.hide();
}
function onkeyupNum(v){
	if(0==v.charAt(0)){
		$("#tmaid_num").val("");
	}
}
/*
 * 药具增加
 */
function save(){
	tmaid++;
	var tmgd_name = $("#tmgd_name").val().trim();
	var tmad_name = $("#tmad_name").val().trim();
	var tmaid_num = $("#tmaid_num").val().trim();
	if('' == tmgd_name){warningTip("药具类型：不能为空"); return;}
	if('' == tmad_name){warningTip("药品名称：不能为空"); return;}
	if('' == tmaid_num){warningTip("数量：不能为空"); return;}
	if(!checkIsNum(tmaid_num)){warningTip("数量：只能是整数"); return;}
	if(fucCheckLength(tmaid_num)>5){warningTip("数量：不能大于5位"); return;}
	var data = getForm("yaoju");
	//得到的JSON			
	var strJSON = data.substring(1,data.length-1);
	//转换后的JSON对象
	var obj = eval( "(" + strJSON + ")" );
	var jsonObj = {};
    jsonObj.Rows = [];
	$.each(detail.getData(), function (i, item) {
		jsonObj.Rows.push({
       		tmaid_id:item.tmaid_id,
			tmgd_name:item.tmgd_name,
			tmad_name:item.tmad_name,
			t_tmgd_name:item.t_tmgd_name,
			t_tmad_name:item.t_tmad_name,				
			tmaid_num:item.tmaid_num,
			tmad_company_name:item.tmad_company_name,
			tmad_price:item.tmad_price,
			tmad_batch_code:item.tmad_batch_code,
			tmad_unit:item.tmad_unit,
			tmad_spec:item.tmad_spec,
			tmad_description:item.tmad_description,
			tmad_qgp:item.tmad_qgp,
			money:parseInt(item.tmaid_num) * parseFloat(item.tmad_price)
       	});
    });
    jsonObj.Rows.push({
		tmaid_id:tmaid,
		tmgd_name:$("#tmgd_name").find("option:selected").text(),
		tmad_name:$("#tmad_name").find("option:selected").text(),
		t_tmgd_name:obj.tmgd_name,
		t_tmad_name:obj.tmad_name,				
		tmaid_num:obj.tmaid_num,
		tmad_company_name:obj.tmad_company_name,
		tmad_price:obj.tmad_price,
		tmad_batch_code:obj.tmad_batch_code,
		tmad_unit:obj.tmad_unit,
		tmad_spec:obj.tmad_spec,
		tmad_description:obj.tmad_description,
		tmad_qgp:obj.tmad_qgp,
		money:parseInt(obj.tmaid_num) * parseFloat(obj.tmad_price)
	});
    detail.set({ data: jsonObj });
    mingxi.push({
    	tmaid_id:tmaid,
    	tmad_id:obj.tmad_name,
    	tmaid_num:obj.tmaid_num
    });
	add_dialog.hide();
}
/*
 * 表格刷新
 */
function reload(){
	_jsonObj.methodname = "queryPage";
	manager.loadData();
}
/*
*查看
*/
function Detail(record){
	$("#d_tmaim_code").val(record.tmaim_code);
	$("#d_tmaim_time").val(record.tmaim_time);
	$("#d_org").val(record.org_id);
	$("#d_create_by").val(record.create_by);
	initWindowByDiv2('chakan-div', '药具入库单查看', 720, 450, closeWin);
	//定义明细的参数
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaIncomeAction",
		"methodname": "detail",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmaim_id\":\""+record.tmaim_id+"\"}]";
	chakan.setOptions({url:_url,parms: param});
}
/*
 * 药具入库单
 */
 var addData_dialog; 
function addData(){
	document.getElementById('rukudan').reset();
	addData_dialog = initWindowByDiv('rukudan-div', '药具入库单', 690, 450, insert, function(){
		if(add_dialog==null){
		}else{
			add_dialog.hide();
		}
		addData_dialog.hide();
	});
	mingxi = [];
	tmaid = 0;
	$("#create_by").val(userName);
	$("#org_id").val(orgName);
	var shijian = getCurDateTime();
	$("#tmaim_time").ligerDateEditor({showTime: true, width:180});
	$("#tmaim_time").ligerGetDateEditorManager().setValue(shijian.substring(0,shijian.lastIndexOf(":")));
	var nian = shijian.substring(0,shijian.indexOf("-"));
	var yue = shijian.substring(shijian.indexOf("-")+1,shijian.lastIndexOf("-"));
	var tian = shijian.substring(shijian.lastIndexOf("-")+1,shijian.indexOf(" "));
	var xiaoshi = shijian.substring(shijian.lastIndexOf(" ")+1,shijian.indexOf(":"));
	var fenzhong = shijian.substring(shijian.indexOf(":")+1,shijian.lastIndexOf(":"));
	var miao = shijian.substring(shijian.lastIndexOf(":")+1);
	var str = "KM" + nian + yue + tian + xiaoshi + fenzhong + miao;
	var rukubianhaoSize = rukubianhao.length;
	var	intSeq = parseInt(rukubianhao);
	intSeq++;
	var seqSize = (intSeq + "").length;
	var s = "";
	while (rukubianhaoSize - seqSize > 0)
	{
		s += "0";
		rukubianhaoSize--;
	}
	rukubianhao = s + intSeq;
	str = str + s + intSeq;
	$("#tmaim_code").val(str);
	detail.loadData();
	var jsonObj = {};
    jsonObj.Rows = [];
    detail.set({ data: jsonObj });
}
/*
 * 新建入库信息
 */
function insert(){
	var tmaim_code = $("#tmaim_code").val().trim();
	var tmaim_time = $("#tmaim_time").val().trim();
	if('' == tmaim_code){warningTip("入库编号：不能为空"); return;}
	if(!checkIsStrNum(tmaim_code)){
		warningTip("入库编号：必须为字母、数字组成");
		return;
	}
	if(fucCheckLength(tmaim_code) > 32){
		warningTip("入库编号：不能超过32字符");
		return;
	}
	if('' == tmaim_time){warningTip("入库日期：不能为空"); return;}
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaIncomeAction",
		"methodname": "save",
		"logicdata": [],
		"extenddata": []
	};		
	var data = getForm("rukudan");
	var d = data.substring(0,data.length-2);
	d = d+",ids:"+JSON.stringify(mingxi)+"}]";
	param.logicdata = d;
	callserver(param, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
}
/*
 * 入库单删除
 */
function delData(){
	var str = "";
    var rows = manager.getCheckedRows();
    $(rows).each(function (){
    	str += this.tmaim_id + ",";
    });
    str=str.substring(0,str.length-1);
	if(str == ""){
		warningTip('请至少选则一个入库单进行操作');
		return;
	}
	$.ligerDialog.confirm('确定要删除选中的数据吗？', function (opt) { 			
		if(opt){
			_jsonObj.methodname = "delete";
			_jsonObj.logicdata = "[{\"ids\":\"" + str + "\"}]";
			callserver(_jsonObj, function(){ reload(); }, function(){});
		}
	});
}

/*
 * ajax成功回调
 */
function ajaxCallbackSuccFunc(data, textStatus){
	if(data.result){
		addData_dialog.hide();
	}
	succMsgTip(data.resultrecord);
	reload();
}

/*
 * ajax失败回调
 */
function ajaxCallbackErrorFunc(data, textStatus){
	warningTip(data.resultrecord);
}
/*
*格式化两位小数
*/
function formatCurrency(num)
{
	if (!num) return "0.00";
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
    num = "0.00";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    cents = num % 100;
    num = Math.floor(num / 100).toString();
    if (cents < 10)
    	cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
    	num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
    return (((sign) ? '' : '-') + '' + num + '.' + cents);
}
</script>
</head>
	<body>
		<div id="manager"></div>
		<div id="chakan-div" style="display: none;">				
				<table class="form_table">
					<tr>
						<td class="form_label">入库编号：</td>
						<td><input disabled="disabled" class="textbg1" id="d_tmaim_code" name="d_tmaim_code"/></td>
						<td class="form_label">入库日期：</td>
						<td><input disabled="disabled" class="textbg1" id="d_tmaim_time" name="d_tmaim_time"/></td>
					</tr>
					<tr>
						<td class="form_label">录入人：</td>
						<td><input disabled="disabled" class="textbg1" id="d_create_by" name="d_create_by"/></td>
						<td class="form_label">组织机构：</td>
						<td><input disabled="disabled" class="textbg1" id="d_org" name="d_org"/></td>
					</tr>
					<tr>
						<td colspan="4"><div id="chakan"></div></td>
					</tr>					
				</table>
		</div>
		<div id="rukudan-div" style="display: none;">
			<form id="rukudan" name="rukudan">
			<input type="hidden" id="tmaim_is_valid" name="tmaim_is_valid" value="1"/>
			<input type="hidden" id="tmaim_type" name="tmaim_type" value="1"/>
				<table class="form_table">
					<tr>
						<td class="form_label">入库编号：</td>
						<td><input class="textbg1" id="tmaim_code" name="tmaim_code"/></td>
						<td class="form_label">入库日期：</td>
						<td align="center"><input onkeyup="this.value=formatdata(this.value);" id="tmaim_time" name="tmaim_time"/></td>
					</tr>
					<tr>
						<td class="form_label">录入人：</td>
						<td><input readonly="readonly" class="textbg1" id="create_by" name="create_by" /></td>
						<td class="form_label">组织机构：</td>
						<td><input disabled="disabled" class="textbg1" id="org_id" name="org_id" value=""/></td>
					</tr>
					<tr>
						<td colspan="4"><div id="detail"></div></td>
					</tr>					
				</table>
			</form>
		</div>
		<div id="yaoju-div" style="display: none;">
			<form id="yaoju" name="yaoju">
			<input type="hidden" id="tmaid_id" name="tmaid_id"/>
				<table class="form_table">
					<tr>
						<td class="form_label">药具类型：</td>
						<td>
						<select style=" width: 182px;" id="tmgd_name" name="tmgd_name" onchange="tmgd_name_change(this.value);">
							<option value="">--请选择--</option>
						</select>
						</td>
						<td class="form_label">药品名称：</td>
						<td>
						<select style=" width: 182px;" id="tmad_name" name="tmad_name" onchange="tmad_name_change(this.value);">
							<option value="">--请选择--</option>
						</select>
						</td>
					</tr>
					<tr>
						<td class="form_label">药品描述：</td>
						<td><input readonly="readonly" class="textbg1" id="tmad_description" name="tmad_description" value=""/></td>
						<td class="form_label">药品规格：</td>
						<td><input readonly="readonly" class="textbg1" id="tmad_spec" name="tmad_spec"  value=""/></td>
					</tr>
					<tr>
						<td class="form_label">药品单位：</td>
						<td><input readonly="readonly" class="textbg1" id="tmad_unit" name="tmad_unit" value=""/></td>
						<td class="form_label">生产厂商：</td>
						<td><input readonly="readonly" class="textbg1" id="tmad_company_name" name="tmad_company_name" value=""/></td>
					</tr>
					<tr>
						<td class="form_label">保质期：</td>
						<td><input readonly="readonly" class="textbg1" id="tmad_qgp" name="tmad_qgp" value=""/></td>
						<td class="form_label">批号：</td>
						<td><input readonly="readonly" class="textbg1" id="tmad_batch_code" name="tmad_batch_code" value=""/></td>
					</tr>
					<tr>
						<td class="form_label">价格：</td>
						<td><input readonly="readonly" class="textbg1" id="tmad_price" name="tmad_price" value=""/></td>
						<td class="form_label">数量：</td>
						<td><input class="textbg1" id="tmaid_num" name="tmaid_num" onkeyup="onkeyupNum(this.value);"/></td>
					</tr>					
				</table>
			</form>
		</div>
	</body>
</html>